package com.xiaohe.qd.util;
 
public class TicketRunnable implements Runnable{
	private int ticketnum=100;//100张票
 
	@Override
	public void run() {
		while(ticketnum>0){
			synchronized (this) {
				if(ticketnum>0){
					System.out.println(Thread.currentThread()+"售出第"+(ticketnum--)+"张票");
					try {
						Thread.currentThread();
						Thread.sleep(200);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}
	}
}